package com.cyf.xjtech_android

class CustomQueue<E>() {
    private var data: ArrayList<E> = ArrayList()

    public fun push(e: E) {
        data.add(e)
        if (data.size >= 3) {
            data.removeFirst()
        }
    }

    public fun pull(): E? {
        if (data.isEmpty()) {
            return null
        }
        val e = data.first()
        data.removeFirst()
        return e
    }

    fun isEmpty():Boolean{
        return data.isEmpty()
    }
}